package com.haixiaoke.saas.enterprise.task;

import com.haixiaoke.saas.lock.service.IHouseLockService;
import com.haixiaoke.saas.lock.service.ILockFaceService;
import com.haixiaoke.saas.lock.service.ILockPwdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 锁定时任务
 *
 * @author qixi
 * @date 2024/7/30
 */
@Component
public class LockTask {


    @Autowired
    private ILockFaceService lockFaceService;
    @Autowired
    private ILockPwdService lockPwdService;
    @Autowired
    private IHouseLockService houseLockService;

    /**
     * 每分钟执行一次密码有效变更任务
     */
    @Scheduled(cron = "0 * * * * ?")
    public void lockPwdEffectiveStatusTask() {
        lockPwdService.lockFaceEffectiveStatusTask();
    }

    /**
     * 自动冻结智能锁任务
     */
    @Scheduled(cron = "0 0 0 * * ?")
    public void lockAutoFreezeTask() {
        houseLockService.lockAutoFreezeTask();
    }

}
